package org.neuedu.ssmp.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.neuedu.ssmp.crm.entity.Gx;

import java.util.List;

public interface GxMapper extends BaseMapper<Gx> {
    @Select("SELECT b.name,MID(order_time,1,4) orderTime,sum(a.amount) amount FROM orders a join customer b on a.customer_id=b.id group by name")
    List<Gx> gx();
    @Select("SELECT MID(order_time,1,4) orderTime FROM orders a join customer b on a.customer_id=b.id group by MID(order_time,1,4)")
    List<Gx> gxc();
    @Select("SELECT b.name,sum(a.amount) amount FROM orders a join customer b on a.customer_id=b.id where name like '%${name}%' and MID(order_time,1,4)=#{orderTime} group by MID(order_time,1,4),name")
    List<Gx> gxa(String name,String orderTime);
}
